<?php
// -----------------------------------------------------------------------------
// include
// -----------------------------------------------------------------------------

include "../config/config.php";
include "../auth.php";
include "../DBManager.php";

// -----------------------------------------------------------------------------
// 访问设置
// -----------------------------------------------------------------------------

if (!isset($_GET["id"])) {
    exit("需要传入有效的参数！");
}

$id = $_GET["id"];

// -----------------------------------------------------------------------------
// 数据库相关设置
// -----------------------------------------------------------------------------

$dbPath = "../" . $dbPath;
$db = new DBManager("sqlite:" . $dbPath);

// -----------------------------------------------------------------------------

$categoryDetails = $db->getCategoryDetailsById($id);

$title = $categoryDetails['title'];
$description = $categoryDetails['description'];

$arr = [
    "title" => $title,
    "description" => $description,
];

$json = json_encode($arr);

echo $json;
